package cn.itrip.auth.service;

import cn.itrip.beans.pojo.ItripUser;

/**
 * 用户管理接口
 *
 * @author hduser
 */
public interface UserService {

    /**
     * 根据用户名查询用户信息
     *
     * @param username username
     * @return 用户信息
     * @throws Exception Exception
     */
    ItripUser findByUsername(String username) throws Exception;

    /**
     * 邮箱创建用户
     *
     * @param user user
     * @throws Exception Exception
     */
    void itriptxCreateUser(ItripUser user) throws Exception;

    /**
     * 邮箱注册用户激活
     *
     * @param email email
     * @param code  验证码
     * @return boolean
     * @throws Exception
     */
    boolean activate(String email, String code) throws Exception;

    /**
     * 手机号创建用户
     *
     * @param user
     */
    void itriptxCreateUserByPhone(ItripUser user) throws Exception;

    /**
     * 验证手机验证码是否正确
     *
     * @param phoneNumber 用户手机号码
     * @param code        验证码
     * @return boolean
     */
    boolean validatePhone(String phoneNumber, String code) throws Exception;

    /**
     * 用户登录
     * @param name name
     * @param password password
     * @return ItripUser
     * @throws Exception
     */
    ItripUser login(String name, String password) throws Exception;
}
